package com.jme.s3d;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.UIManager;

public class LogoFrame extends JFrame {

	private static final Dimension screenSize = Toolkit.getDefaultToolkit()
			.getScreenSize();
	private static final Image logoImage = new ImageIcon(LogoFrame.class
			.getClassLoader().getResource("data/texture/logo1.png")).getImage();
	private TimerTask tt = new TimerTask() {
		@Override
		public void run() {
			LogoFrame.this.dispose();
			Main main = new Main();
			main.start();
		}
	};
	private Timer t;

	public LogoFrame() {
		setUndecorated(true);
		setSize(400, 187);
		setLocation((int) screenSize.getWidth() / 2 - this.getWidth() / 2,
				(int) (screenSize.getHeight() / 2 - this.getHeight() / 2));
		setVisible(true);

		t = new Timer();
		t.schedule(tt, 5000);
	}

	public void paint(Graphics g) {
		g.drawImage(logoImage,0,0,this.getWidth(),this.getHeight(),null);
	}

	public static void main(String[] args) {
		try {
			UIManager
					.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch (Exception e) {

		}
		new LogoFrame();
	}
}
